home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / mini / Sendmail+UUCP < prev    next >
Text File  |  1997-11-15  |  15KB  |  419 lines

  1.  
  2.                              SENDMAIL + UUCP HOWTO
  3.                                        
  4.                                        
  5.     _Author:_ Jamal Hadi Salim (jamal@glcom.com or hadi@cyberus.ca)
  6.     
  7.    
  8.    
  9.    
  10.   History:
  11.   
  12.    Initial edition July/96: works only with non-bind edition of sendmail
  13.    
  14.    Oct 01 /96: works with the redhat supplied binary
  15.    
  16.    Oct 07 /96: added/modified a tip on how to compile non-bind sendmail
  17.    
  18.    Oct 25 /96: added/modified a tip on how to keep sendmail
  19.    getHostbyAddr() happy via a dummy /etc/hosts entry
  20.    
  21.    Mar 15 /97: I am amazed at the response/feedback i am receiving so i
  22.    decided to refine this further. Fixed some small errors; added diagram
  23.    + references.
  24.    
  25.    Oct 25/97: Htmlise+ add blurb on DNS capable machines
  26.    
  27.    
  28.      _________________________________________________________________
  29.    
  30.    
  31.    
  32.    After finally settling down and properly reading TFM (the Bat Book, to
  33.    be precise) i have solved the Caramilk secret! The steps below have
  34.    been tested with the binary supplied by RedHat. Perhaps i should send
  35.    this tip to the maintainer of the Sendmail FAQ too since there is
  36.    absolutely no mention of UUCP interworking with sendmail there.
  37.    
  38.    
  39. What this Document tries to show you
  40.  
  41.    How to setup a single machine, reffered to as _me.com _in the example,
  42.    with no direct access to the internet to route mail for you via
  43.    sendmail and UUCP to a 'smarter host' eg your ISP.
  44.    Optionally you can configure this machine to feed other machines i.e
  45.    you are their 'smart' host or gateway.
  46.    
  47. What this Document does not tell you
  48.  
  49.    I have been receiving incredible number of questions regarding topics
  50.    which are beyond the focus of this HOWTO. The purpose of this document
  51.    is not to describe them so please try not send me any questions on the
  52.    following:
  53.    
  54.    
  55.   a) How to setup UUCP.
  56.   
  57.    Refer to many fine references on this, including:
  58.    
  59.    UUCP HOWTO (Vince Skahan, )
  60.    
  61.    Using and managing UUCP (Ed Ravin et al -- publisher O'reilly) which i
  62.    think is the best authority on UUCP
  63.    
  64.    Linux Network Administrator Guide (Olaf Kirch)
  65.    
  66.    
  67.   b) how to setup DNS.
  68.   
  69.    Refer to the many fine references on this, including:
  70.    
  71.    Caching named mini howto (Nicolai Langfeldt)
  72.    
  73.    The bat book (Sendmail;Costalles, Allman, Rickert;publisher O'reilly)
  74.    
  75.    DNS and BIND (Publisher O'reilly)
  76.    
  77.    TCP/IP Network Administration (Hunt, Craig;Publisher O'reilly)
  78.    
  79.    Linux Network Administrator Guide (Olaf Kirch)
  80.    
  81.    sendmail Theory and Practice (Avolio and Vixie; publisher Digital
  82.    press)
  83.    
  84.    
  85.   c) how to setup databases (other than the mailertable) to work with sendmail.
  86.   
  87.    Refer to the many fine references on this, including:
  88.    
  89.    The bat book (Sendmail;Costalles, Allman, Rickert -- publisher
  90.    O'reilly)
  91.    
  92.    TCP/IP administration (Publisher O'reilly)
  93.    
  94.    Sendmail Theory and Practice (Avolio and Vixie; publisher Digital
  95.    press)
  96.    
  97.    Docs bundled with sendmail d) how to write or modify rulesets or
  98.    mailers.
  99.    
  100.    All the above references  in c)
  101.    
  102.    You can also find help on the following _newsgroups_:
  103.    comp.mail.sendmail
  104.    comp.mail.uucp
  105.    comp.os.linux.networking
  106.    _IRC channels_
  107.    #linux, #unix
  108.    
  109.      _________________________________________________________________
  110.    
  111. THE SETUP
  112.  
  113.    This is for a system, hypothecally named _me.com_, whose mail is sent
  114.    out only via UUCP. _mysmarthost _is the ISPs hostname as set up in the
  115.    _uucp sys file _and _me.com _is the hostname we use or are known by in
  116.    the MX records on the internet.
  117.    _mysmarthost_ hooks to the internet. We really dont care how it does
  118.    it, we just know it knows how to get us there.
  119.    _me.com_, whose setup we describe in the example, feeds sites
  120.    _down.com _and _system1.org _and their subnodes. _me.com _connects to
  121.    _down.com_ via TCP/IP and connects to _system1.org _via raw UUCP using
  122.    a phone line.
  123.    The setup description is shown below:
  124.    
  125.         ------------------------
  126.         |                       |
  127.         |     Internet          |
  128.         |                       |
  129.         -----------------------
  130.                     |
  131.                     | PPP/dedicated line running TCP-IP
  132.                     |
  133.                 -------------
  134.                 |            |
  135.                 |mysmarthost | Authoritative name server for
  136.                 |            | *.me.com, *.down.com, *.system1.org
  137.                 |            |
  138.                 --------------
  139.                     |
  140.                     | UUCP via a phone line receive for
  141.                     | system1.org, *.system1.org,*.down.com, down.com
  142.                     | as well as me.com and *.me.com
  143.                  ------------
  144.                 | * *****  *  |
  145.    ------------ | * me.com *  | ------
  146.                 | *        *  |      |
  147.    |            | * *****  *  |      |
  148.    |             ------------        |
  149.    |UUCP via phone line              | uucp via TCP/IP
  150.    |                                 |
  151.  -----------                  -----------
  152. |           |                |           |
  153. |system1.org|                | down.com  |-------
  154. |           |                |           |      |
  155.  ----------                  ------------       |
  156.      |                                      &
  157. nbsp;   |
  158.      |                                      &
  159. nbsp;   |
  160.      |                                      &
  161. nbsp;   | LAN: smtp to nodes
  162.      | UUCP phone line
  163.      |                                      &
  164. nbsp;   |
  165. -----------                             -------------
  166. |         |                             |     &nbs
  167. p;     |
  168. |system1's|                             | down's    |
  169. |subnodes |                             | LAN       |
  170. |         |                             ------------
  171. ----------
  172.  
  173.  pre-requisites
  174.  
  175.    _1)_ If you are already running DNS or have a pointer to a DNS server
  176.    (in your /etc/resolv.conf) and are on a live connection to the net
  177.    then skip this part. You are safe. You dont have to do any 'smart'
  178.    thing skip to  _2)_
  179.    If you are on a machine using uucp for mail then you dont really need
  180.    to compile bind/resolv into sendmail;
  181.    
  182.   How to survive name canonicalization on a stand-alone machine with no DNS
  183.   
  184.    _PART I_
  185.     If you get a pre-compiled sendmail with BIND in it you can still live
  186.    with it (As is the case with Redhat supplied sendmail).
  187.    
  188.    a) Refer to my solution for this based on the m4 file described (my
  189.    favorite). Try to use this option unless you really insist on b) or c)
  190.    below OR
  191.    
  192.    b)If you talk to me i could supply you with a non-BIND compiled
  193.    version (8.8.5). Perhaps RedHat should consider supplying two sendmail
  194.    binaries (like slakware) One with BIND and the other with no BIND. OR
  195.    
  196.    c) The quickest solution to get sendmail with no bind is to edit
  197.    _src/conf.h_ lines below to read as i have shown:
  198.    
  199.    _# ifndef NAMED_BIND conf.h:# define NAMED_BIND 0 /* use Berkeley
  200.    Internet Domain Server */_
  201.    
  202.    _PART II_:
  203.    Sendmail would however normally insist on doing name look ups to
  204.    resolve the host part using _gethostbyaddr()_ for each email it sends
  205.    (even if you tell it not to canonify names).
  206.    
  207.    a) use an _RFC1597_ IP address (10.0.0.0-10.255.255.255,
  208.    172.16.0.0-172.31.255.255, 192.168.0.0-192.168.255.255)
  209.    Edit _/etc/hosts _and add the following as a sample for the host
  210.    myhost
  211.    _10.0.0.1 myhost.me.com myhost_ or
  212.    b) If you use NIS (and NIS is compiled into sendmail as seems to be
  213.    the case in Redhat. ) make sure the _/etc/nsswitch.conf _file
  214.    contains:
  215.    _hosts: files dns_ and in _/etc/hosts_ and add the following as a
  216.    sample for the host myhost [again using RFC1597 IP addressing scheme]
  217.    _10.0.0.1 myhost.me.com myhost_
  218.    
  219.    _NOTE: _---- In both a) and b) above it is critical that you list the
  220.    long (fully qualified) in the /etc/hosts file used. i.e the line
  221.    should read _10.0.0.1 myhost.me.com myhost_ and NOT _10.0.0.1 myhost
  222.    _you will also need to define the sendmail _$j _macro to hold
  223.    _myhost.me.com_
  224.    add the Following line to your _/etc/sendmail.cf _after it is
  225.    generated _Djmyhost.me.com_ (or you can use
  226.    _MASQUAREADE_AS(myhost.me.com)_ in the _.mc_ below)
  227.    
  228.    _NOTE_!!!!! _myhost_ as a domain name is given as an example; you dont
  229.    have to use it as is. Pick your own hostname if you dont have one
  230.    already.
  231.    
  232.      _________________________________________________________________
  233.    
  234.    __
  235.    
  236.    _2)_ Ensure that you have makemap and it is capable of supporting hash
  237.    and or the more common dbm format  or even btree format (The Redhat
  238.    version does not support dbm). Makemap is normaly distributed with
  239.    sendmail.
  240.    
  241.    
  242.    
  243.   SETUP (the mc file)
  244.   
  245.    I) create your .mc file using your favorite editor; i'll call this
  246.    file _my.mc_
  247.    
  248.    _a) No DNS -- standalone_
  249.    
  250.      _________________________________________________________________
  251.    
  252.    
  253.    i_nclude(`../m4/cf.m4')_
  254.    _VERSIONID(`me.com's setup with uucp created by xxxx --no dns ')_
  255.    _dnl OSTYPE(linux)_
  256.    _FEATURE(nodns)dnl_
  257.    _FEATURE(nocanonify)dnl_
  258.    _FEATURE(always_add_domain)dnl_
  259.    _FEATURE(mailertable, hash /etc/mailertable)dnl_
  260.    _MAILER(local)dnl_
  261.    _MAILER(smtp)dnl_
  262.    _MAILER(uucp)_
  263.    _define(`SMART_HOST', uucp-dom:mysmarthost)_
  264.    
  265.      _________________________________________________________________
  266.    
  267.    
  268.    
  269.    Let's dissect this:
  270.    
  271.    _include(`../m4/cf.m4')_ requests for the m4 macro found in
  272.    ../m4/cf.m4 to be include to resolve some things
  273.    
  274.    _VERSIONID(`me.com's setup with uucp created by xxxx')dnl_  This is
  275.    used to distinguish the different versions of .cf file you might end
  276.    up creating.
  277.    
  278.    _OSTYPE(linux)_ This is used to define/redefine linux specific stuff.
  279.    It is safe to have it here.
  280.    
  281.    _FEATURE(nodns)dnl _This says we dont have a DNS server (so in effect
  282.    we are using uucp only for mail. Sendmail must be compiled not to use
  283.    bind) This is now obsolete. I will let it stay here just in case you
  284.    use an older version of sendmail.
  285.    
  286.    _FEATURE(nocanonify)dnl _This says Don't pass addresses to _$[ ... $]_
  287.    for canonification. Normally if you have BIND compiled in sendmail
  288.    would try and expand the alias/IP address to a canonical name using
  289.    DNS. You dont wanna do this if all you have are feeds which connect to
  290.    you via UUCP i.e you are a stand alone.
  291.    
  292.    _FEATURE(always_add_domain)dnl_ This adds the local domain host name
  293.    even on locally delivered mail Not necessary i just like it; _This
  294.    might not be a safe feature since spammers, with proper setup
  295.    conditions, can abuse you_.
  296.    me.com is not connected to the net via tcp/ip so it is safe
  297.    
  298.    _FEATURE(mailertable, hash /etc/mailertable)dnl_ the file
  299.    _/etc/mailertable_ is going to be a _hash _database where we will
  300.    store routing information of certain sites. If you dont have anyone
  301.    who you feed uucp to then you dont need this. More on this later. If
  302.    you wanted to use the _dbm _format you would have_
  303.    FEATURE(mailertable, dbm /etc/mailertable)dnl  _If you wanted to use
  304.    the _btree_ format you would have _FEATURE(mailertable, btree
  305.    /etc/mailertable)dnl_
  306.    
  307.    _MAILER(local)dnl MAILER(smtp)dnl MAILER(uucp)_ These are the mailers
  308.    we use.
  309.    
  310.    _define(`SMART_HOST', uucp-dom:mysmarthost) _Our smart host is our ISP
  311.    who is defined in the uucp _sys_ file as _system mysmarthost_. Any
  312.    messages that we cant handle (i.e ones for domains or mailers we dont
  313.    understand) will be passed on to our smarthost/ISP to figure out. note
  314.    we use  uucp-dom as the uucp mailer. This particular mailer uses smtp
  315.    rewriting rules.
  316.    
  317.    
  318.    _b) DNS on_
  319.    
  320.      _________________________________________________________________
  321.    
  322.    
  323.    _include(`../m4/cf.m4')_
  324.    _VERSIONID(`me.com's setup with uucp created by xxxx --dns
  325.    enabled')dnl_
  326.    _OSTYPE(linux)_
  327.    _FEATURE(always_add_domain)dnl_
  328.    _FEATURE(mailertable, hash /etc/mailertable)dnl_
  329.    _MAILER(local)dnl_
  330.    _MAILER(smtp)dnl_
  331.    _MAILER(uucp)_
  332.    _define(`SMART_HOST', uucp-dom:mysmarthost)_
  333.    
  334.      _________________________________________________________________
  335.    
  336.    
  337.    
  338.    
  339.   II) create your sendmail.cf file
  340.   
  341.    a) backup your old _/etc/sendmail.cf_ file
  342.    b) overwrite the sendmail.cf with the new one: _m4 my.mc >
  343.    /etc/sendmail.cf_
  344.    c) verify that the sendmail.cf file was correctly created based on
  345.    your specifications.
  346.    Some of the gotchas that i came across were: - _missing uucp-dom
  347.    mailer _This was because i didnt have the smtp mailer entry. Actually,
  348.    i understand it is important to have it defined before the uucp
  349.    
  350.    
  351.   III) create your /etc/mailertable
  352.   
  353.    if you dont have uucp sites feeding off you skip this step
  354.    
  355.    a) create/edit the file /etc/mailertable
  356.    
  357.    sample /etc/mailertable
  358.    
  359.      _________________________________________________________________
  360.    
  361.    
  362.    
  363.    _system1.org uucp-dom:system1_
  364.    _.system1.org uucp-dom:system1_
  365.    _down.com uucp-dom:down_
  366.    _up.down.com  error: Host is unknown at me.com_
  367.    _.down.com uucp-dom:down_
  368.    _.me.com error: Host unknown at me.com_
  369.    
  370.      _________________________________________________________________
  371.    
  372.    
  373.    
  374.    This says anything that is addressed to _system1.org_ or to
  375.    _*.system1.org _that we receive will be sent using the _uucp-dom_
  376.    mailer and be delivered to _system1_ (defined in the the uucp _sys
  377.    _file) in other words we are doing the mail routing for _*.system1.org
  378.    ; _similar for _down.com _and its subnodes except for the additional
  379.    filtering; we bounce back any mail for down's subnode _up.down.com
  380.    _using sendmail's built-in _error _mailer with the message _"Host is
  381.    unknown at me.com"_; This is because we have been asked to do this by
  382.    the admin at _down.com._ To bounce unknown subdomains to us we use the
  383.    last line in the mailertable (which is what all unknown nodes default
  384.    to).
  385.    b) create the database with _makemap_
  386.    
  387.    if you use _hash_:
  388.    _makemap hash /etc/mailertable < /etc/mailertable_
  389.    if you use _dbm:_
  390.    _makemap dbm /etc/mailertable </etc/mailertable_
  391.    if you use_ btree:_
  392.    _makemap btree /etc/mailertable </etc/mailertable___
  393.    
  394.    do this every time you change the file.
  395.    __
  396.    
  397.   IV) restart sendmail
  398.   
  399.   V) test sendmail
  400.   
  401.    i) sendmail -bv user@destination
  402.    ii) using sendmail -bt and enter various addresses using 3,0
  403.    ruleset to see where they end up and the various rulesets and cf walks
  404.    taken.
  405.    
  406.    _You are set!_
  407.    
  408.    
  409.      _________________________________________________________________
  410.    
  411.   TODO
  412.   
  413.    
  414.    
  415.    1) Add info on setting up system down.com (so as to show how to
  416.    take care of those smtp nodes)
  417.    2) Add info on how to setup news to be delivered via UUCP
  418.    (preferably INN). This might require changing the title of the doc.
  419.